package com.dimples.dd.system.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dimples.dd.mybatis.core.type.JsonLongSetTypeHandler;
import com.dimples.dd.tenant.core.dataobject.TenantBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.Set;

/**
 * 用户信息表
 */
@Schema(description = "用户信息表")
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "system_users")
public class SystemUsersDO extends TenantBaseDO {
    /**
     * 用户ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "用户ID")
    private Long id;

    /**
     * 用户账号
     */
    @TableField(value = "username")
    @Schema(description = "用户账号")
    private String username;

    /**
     * 密码
     */
    @TableField(value = "`password`")
    @Schema(description = "密码")
    private String password;

    /**
     * 用户昵称
     */
    @TableField(value = "nickname")
    @Schema(description = "用户昵称")
    private String nickname;

    /**
     * 备注
     */
    @TableField(value = "remark")
    @Schema(description = "备注")
    private String remark;

    /**
     * 部门ID
     */
    @TableField(value = "dept_id")
    @Schema(description = "部门ID")
    private Long deptId;

    /**
     * 岗位编号数组
     */
    @TableField(value = "post_ids", typeHandler = JsonLongSetTypeHandler.class)
    @Schema(description = "岗位编号数组")
    private Set<Long> postIds;

    /**
     * 用户邮箱
     */
    @TableField(value = "email")
    @Schema(description = "用户邮箱")
    private String email;

    /**
     * 手机号码
     */
    @TableField(value = "mobile")
    @Schema(description = "手机号码")
    private String mobile;

    /**
     * 用户性别
     */
    @TableField(value = "gender")
    @Schema(description = "用户性别")
    private Byte gender;

    /**
     * 头像地址
     */
    @TableField(value = "avatar")
    @Schema(description = "头像地址")
    private String avatar;

    /**
     * 帐号状态（0正常 1停用）
     */
    @TableField(value = "`status`")
    @Schema(description = "帐号状态（1正常 0停用）")
    private Byte status;

    /**
     * 最后登录IP
     */
    @TableField(value = "login_ip")
    @Schema(description = "最后登录IP")
    private String loginIp;

    /**
     * 最后登录时间
     */
    @TableField(value = "login_date")
    @Schema(description = "最后登录时间")
    private LocalDateTime loginDate;

    /**
     * 默认注册地
     */
    @TableField(value = "register_location")
    @Schema(description = "默认注册地")
    private Long registerLocation;

    /**
     * 用户角色编码集合 ["ROOT","ADMIN"]
     */
    @TableField(exist = false)
    private Set<String> roles;
}